package com.yaha.controler;

import android.app.Application;
import android.content.Context;
import android.net.NetworkInfo.DetailedState;

import com.yaha.controler.devices.DeviceManager;
import com.yaha.controler.devices.pojo.MdnsDevice;
import com.yaha.controler.utils.MyLog;

import de.greenrobot.event.EventBus;

public class MyApplication extends Application {
	private static final String TAG = MyApplication.class.getSimpleName();
	private static MyApplication myApp = null;
	private static Context mInstance;
	private static String name;
	private static String filePath;

	public static String getName() {
		return name;
	}

	public static void setName(String name) {
		MyApplication.name = name;
	}

	public static String getFilePath() {
		return filePath;
	}

	public static void setFilePath(String filePath) {
		MyApplication.filePath = filePath;
	}

	// 消息总线
	public static EventBus eventBus = new EventBus();

	// ---------------------------Wifi设备列表信息---Begin----------------------------------------
	public static DetailedState wifiState;
	public static String curWifiSSID;
	public static String curWifiBSSID;

	// ---------------------------Wifi设备列表信息--End-----------------------------------------

	public static Context getAppContext() {
		return mInstance;
	}

	@Override
	public void onCreate() {
		super.onCreate();
		MyLog.i(TAG, "onCreate");
		myApp = this;
		mInstance = this.getApplicationContext();
	}

	public static MyApplication getApplication() {
		return myApp;
	}

	@Override
	public void onTerminate() {
		super.onTerminate();
	}

	@Override
	public void onLowMemory() {
		super.onLowMemory();
	}
    public static boolean isConnection(){
    	MdnsDevice mCurrentDevice = DeviceManager.newInstance().getChoiceMdnsDevice();
    	if(mCurrentDevice != null){
    		return true;
    	}else{
    		return false;
    	}
    }
}
